/**
 * @Title: 心跳类
 * @Package tt.dz.mvc.controller
 * @author pengyu
 * @date 2015年12月17日 上午10:21:55
 * @version V1.0
 */
package tt.dz.mvc.controller.middleware;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import tt.dz.entity.base.JsonCommon;
import tt.dz.service.middleware.HeartService;
import tt.dz.service.middleware.OmsLogService;
import tt.dz.util.RedisClient;
import tt.dz.util.StringUtil;
@Controller
public class HeartController {
	/**
	 * 日志对象
	 */
	private Logger logger = LoggerFactory.getLogger(HeartController.class);
	@Autowired
	HeartService heartService;	
	// 
	@RequestMapping("/heartUpload") 
	@ResponseBody
	public JsonCommon<String> heartUpload(HttpServletRequest request, HttpServletResponse response) throws Exception {
		Map<String,String> map = StringUtil.getParameterByMiddle(request);
		String protocol_type = map.get("protocol_type");
		String protocol_version = map.get("protocol_version");
		String data = map.get("data");
		if(StringUtil.isBlank(protocol_type)||StringUtil.isBlank(protocol_version)||StringUtil.isBlank(data)){
			JsonCommon<String> json = new JsonCommon<String>();
			json.setCode("400");
			json.setMsg("protocol_type or protocol_version or data null");
		}
		return heartService.uploadHeart(map);
	}
	
}
